<template>
    <view>
        <!-- parse <template is="newsDetailTpl" :data="id,isLoad,news"/> -->
        <block name="newsDetailTpl">
            <view v-if="isLoad === null" class="margin-top load notexist text-l load-project"></view>
            <view v-if="isLoad === false" class="margin-top load loading text-l load-project"></view>

            <view v-if="isLoad" class="main padding-project">
                <view v-if="news.NEWS_TYPE == 0" class="article-box margin-top-xs">
                    <!-- article content begin -->
                    <view class="article card-project shadow-project">
                        <view class="title">
                            <text :user-select="true">{{ news.NEWS_TITLE }}</text>
                        </view>
                        <view class="time">{{ news.NEWS_ADD_TIME }} {{ news.NEWS_CATE_NAME }}</view>

                        <block v-for="(item, index) in news.NEWS_CONTENT" :key="index">
                            <view class="content" v-if="item.type == 'text'">
                                <text :user-select="true">{{ item.val }}</text>
                            </view>

                            <view class="pics" v-if="item.type == 'img'">
                                <image
                                    @tap="url"
                                    data-type="img"
                                    :data-url="item.val"
                                    :show-menu-by-longpress="true"
                                    class="loading"
                                    mode="widthFix"
                                    :lazy-load="true"
                                    :src="item.val"
                                ></image>
                            </view>
                        </block>
                        <!-- article content end -->
                    </view>
                    <!-- article content end -->
                </view>

                <web-view v-if="news.NEWS_TYPE == 1" :src="news.NEWS_URL"></web-view>
            </view>
        </block>
    </view>
</template>

<script>
let behavior = require('../../../../behavior/news_detail_bh.js');
let PassortBiz = require('../../../../biz/passport_biz.js');
let skin = require('../../skin/skin.js');
export default {
    data() {
        return {
            isLoad: '',

            news: {
                NEWS_TYPE: 0,
                NEWS_TITLE: '',
                NEWS_ADD_TIME: '',
                NEWS_CATE_NAME: '',
                NEWS_CONTENT: [],
                NEWS_URL: ''
            }
        };
    },
    mixins: [behavior],
    onReady: function () {
        PassortBiz.initPage({
            skin,
            that: this
        });
    },
    methods: {
        url() {
            console.log('占位：函数 url 未声明');
        }
    }
};
</script>
<style>
@import './news_detail.css';
@import 'undefined';
</style>
